package xcmg.syn.web.supplier;

import com.github.pagehelper.PageInfo;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import xcmg.syn.infra.BasicController;
import xcmg.syn.service.supplier.MmSupplierService;
import xcmg.syn.service.vo.supplier.MmSupplierVO;
import yb.ecp.fast.infra.annotation.FastMappingInfo;
import yb.ecp.fast.infra.infra.ActionResult;
import yb.ecp.fast.infra.infra.PageCommonVO;
import yb.ecp.fast.infra.infra.SearchCommonVO;

@RestController
@RequestMapping("/supplier")
public class MmSupplierController extends BasicController {
    @Autowired
    private MmSupplierService mmSupplierService;


    @PostMapping(value = "/list")
    @ApiOperation("获取广乘GPS供应商列表")
    @FastMappingInfo(needLogin = true)
    public ActionResult<PageInfo<MmSupplierVO>> list(@RequestBody SearchCommonVO<MmSupplierVO> condition) {
        MmSupplierVO v = condition.getFilters();
        if (null == v) {
            v = new MmSupplierVO();
        }
        condition.setFilters(v);
        PageCommonVO<MmSupplierVO> pageCommonVO = mmSupplierService.list(condition);
        return actionResult(pageCommonVO.getPageInfo());
    }

}
